//
//  SyijiWenziTableViewCell.m
//  News
//
//  Created by dlios on 15-5-16.
//  Copyright (c) 2015年 PEAK. All rights reserved.
//

#import "SyijiWenziTableViewCell.h"

@implementation SyijiWenziTableViewCell


- (void)dealloc
{
    [_myView release];
    [_biaoti release];
    [_xiangqing release];
    [_zang release];
    [_zshu release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.myView = [[[UIView alloc] init] autorelease];
      //  _myView.backgroundColor = [UIColor grayColor];
        [self.contentView addSubview:_myView];
        self.zang = [UIButton buttonWithType:UIButtonTypeSystem];
        [_zang addTarget:self action:@selector(zang) forControlEvents:UIControlEventTouchUpInside];
        [_zang setImage:[UIImage imageNamed:@"iconfont-dianzan"] forState:UIControlStateNormal];
        [_myView addSubview:_zang];
        self.biaoti = [[[UILabel alloc] init] autorelease];
       // self.biaoti.backgroundColor = [UIColor redColor];
        _biaoti.numberOfLines = 0;
        [_myView addSubview:_biaoti];
        self.xiangqing = [[[UILabel alloc] init] autorelease];
       // self.xiangqing.backgroundColor = [UIColor cyanColor];
        _xiangqing.numberOfLines = 0;
        [_myView addSubview:_xiangqing];
        self.zshu = [[[UILabel alloc] init] autorelease];
        //_zshu.backgroundColor = [UIColor greenColor];
        [_myView addSubview:_zshu];
       
        self.laiyuan = [[[UILabel alloc] init] autorelease];
        [_myView addSubview:_laiyuan];
    }
    
    return self;
}
- (void)layoutSubviews
{
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    [super layoutSubviews];
    
    self.myView.frame = CGRectMake(10, 10, self.contentView.bounds.size.width - 20, self.contentView.bounds.size.height - 20);
    self.biaoti.frame = CGRectMake(0, 0, _myView.frame.size.width, 40);
    self.xiangqing.frame = CGRectMake(0, _biaoti.frame.size.height, _myView.frame.size.width, 80);
    _zang.frame = CGRectMake(self.myView.bounds.size.width - 80, self.myView.bounds.size.height - 20, 20, 20);
    [_zang setTintColor:[UIColor redColor]];
    _zshu.frame = CGRectMake(self.myView.bounds.size.width - 40, self.myView.bounds.size.height - 20, 60, 20);
//    _laiyuan.frame = CGRectMake(_zshu.frame.origin.x - 300, _zshu.frame.origin.y, 140, 20);
     _laiyuan.frame = CGRectMake(0, self.myView.bounds.size.height - 20, 120, 20);
}

- (void)setYiji:(SReadyijiModel *)yiji
{
    if (_yiji != yiji) {
        [_yiji release];
        _yiji = [yiji retain];
    }
    
    self.biaoti.text = yiji.title;
    self.xiangqing.text = yiji.digest;
    NSString *str = [NSString stringWithFormat:@"%@", yiji.votecount];
    self.zshu.text = str;
    self.laiyuan.text = yiji.source;
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
